import java.awt.Point;
import java.util.List;

import map.Map;
import building.Building;
import field.InvalidBuildingForThisTypeException;


public class Calculator {

	/**
	 * @param args
	 * @throws InvalidBuildingForThisTypeException 
	 */
	public static void main(String[] args) throws InvalidBuildingForThisTypeException {
		Calculator calc = new Calculator();
		
		Building[] buildings = null;
		
		Point[] positionsOfTiberium = new Point[]{new Point(1, 5),new Point(3, 4),new Point(3, 6),new Point(7, 3),new Point(7, 4),new Point(6, 6)};
		Point[] positionsOfCrystal = new Point[]{new Point(1, 3),new Point(2, 1),new Point(3, 1),new Point(3, 2),new Point(6, 1),new Point(7, 1)};
		
		Map bestAllocationMap = calc.getBestAllocation(buildings, positionsOfTiberium, positionsOfCrystal);
		
		System.out.println(bestAllocationMap);
		
	}

	private Map getBestAllocation(Building[] buildings, Point[] positionsOfTiberium, Point[] positionsOfCrystal) {
		
		Map plainMap = new Map(positionsOfTiberium, positionsOfCrystal);
		
		List<Map> maps = plainMap.createAllVariations(buildings);
		
		for (Map map : maps) {
			double value = map.getOverallValue();
			System.out.println(value);
		}
		
		return plainMap;
	}
}
